package com.nbsaas.boot.project.rest.resource;

import com.nbsaas.boot.jpa.data.core.BaseResource;
import com.nbsaas.boot.project.api.apis.ProjectTravelApi;
import com.nbsaas.boot.project.api.domain.request.ProjectTravelRequest;
import com.nbsaas.boot.project.api.domain.response.ProjectTravelResponse;
import com.nbsaas.boot.project.api.domain.simple.ProjectTravelSimple;
import com.nbsaas.boot.project.data.entity.ProjectTravel;
import com.nbsaas.boot.project.data.repository.ProjectTravelRepository;
import com.nbsaas.boot.project.rest.convert.ProjectTravelEntityConvert;
import com.nbsaas.boot.project.rest.convert.ProjectTravelResponseConvert;
import com.nbsaas.boot.project.rest.convert.ProjectTravelSimpleConvert;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.Serializable;
import java.util.function.Function;
/**
 *   出差-业务接口实现
 */
@Transactional
@Service
public class ProjectTravelResource extends BaseResource<ProjectTravel, ProjectTravelResponse, ProjectTravelSimple, ProjectTravelRequest> implements ProjectTravelApi {

    @Resource
    private ProjectTravelRepository projectTravelRepository;

    @Override
    public JpaRepositoryImplementation<ProjectTravel, Serializable> getJpaRepository() {
        return projectTravelRepository;
    }

    @Override
    public Function<ProjectTravel, ProjectTravelSimple> getConvertSimple() {
        return new ProjectTravelSimpleConvert();
    }

    @Override
    public Function<ProjectTravelRequest, ProjectTravel> getConvertForm() {
        return new ProjectTravelEntityConvert();
    }

    @Override
    public Function<ProjectTravel, ProjectTravelResponse> getConvertResponse() {
        return new ProjectTravelResponseConvert();
    }


}


